package com.fwj.auth.strategy.impl;

import com.fwj.auth.entity.user.UserExtendAccount;
import com.fwj.auth.model.BindInfo;
import com.fwj.core.common.common.ImportantInfoUtil;

/**
 * @Author: fwj
 * @Data: 2022/4/23 18:55
 * @Version 1.0
 * @Description:
 */


public enum BindInfoStrategyImpl {

    PHONE{

        @Override
        public void exec(BindInfo bindInfo, UserExtendAccount userExtendAccount) throws Exception {
            bindInfo.setPhone(ImportantInfoUtil.phone(Long.parseLong(userExtendAccount.getValue())));
        }
    },

    EMAIL{
        @Override
        public void exec(BindInfo bindInfo, UserExtendAccount userExtendAccount) throws Exception{
            bindInfo.setEmail(ImportantInfoUtil.email(userExtendAccount.getValue()));
        }
    },

    WECHAT{
        @Override
        public void exec(BindInfo bindInfo, UserExtendAccount userExtendAccount) throws Exception{
            bindInfo.setWechat(ImportantInfoUtil.wechat(userExtendAccount.getValue()));
        }

    },

    QQ{
        @Override
        public void exec(BindInfo bindInfo, UserExtendAccount userExtendAccount) throws Exception{
            bindInfo.setQq(ImportantInfoUtil.qq(Long.parseLong(userExtendAccount.getValue())));
        }
    },

    MICRO_BLOG{
        @Override
        public void exec(BindInfo bindInfo, UserExtendAccount userExtendAccount) throws Exception{
            bindInfo.setMicroBlog(ImportantInfoUtil.other(userExtendAccount.getValue()));
        }
    },
    ;

    //定义抽象方法，执行更新
    public abstract void exec(BindInfo bindInfo, UserExtendAccount userExtendAccount) throws Exception;
}
